<template>
  <div class="film-item">
    <router-link :to="`/film/${filmInfo.filmId}`">
      <div class="img">
        <img src="filmInfo.poster" alt="">
      </div>
      <div class="info">
        <div class="film-name info-col">
          <span class="name">{{ filmInfo.name }}</span>
          <span class="item">{{ filmInfo.filmType.name }}</span>
        </div>
        <div class="film-grade info-col" :style="{visibility: filmInfo.grade ? 'visible' : 'hidden'}">
          <span class="label">观众评分 </span>
          <span class="grade">{{ filmInfo.grade }}</span>
        </div>
        <div class="film-actors info-col">
          <span class="label">主演：于谦  汤梦佳 秦鸣悦  王广源  孙艺杨 </span>
        </div>
        <div class="film-detail info-col">
          <span class="label">{{ filmInfo.nation }} | {{ filmInfo.runtime }}分钟</span>
        </div>
      </div>
      <div class="buy">购票</div>
    </router-link>
  </div>
</template>

<script>
export default {
  name: 'FilmItem',

  props: {
    filmInfo: {
      type: Object,
      default () {
        return {}
      }
    }
  }
}
</script>

<style lang="scss">
@import '~@/assets/styles/mixins.scss';

.film-item {
  @include border-bottom;
  padding: 15px 15px 15px 0;
  height: 94px;
  position: relative;
  box-sizing: content-box;
  background: #fff;
  > a {
    display: flex;
    align-items: center;
  }
  .img {
    flex-shrink: 0;
    width: 66px;
    height: 94px;
    background: rgb(249, 249, 249);
    img {
      width: 100%;
      border-radius: 2px;
    }
  }
  .info {
    flex: 1;
    padding: 0 10px;
    overflow: hidden;
    .info-col {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      width: 100%;
    }
    .film-name {
      .name {
        max-width: calc(100% - 25px);
        color: #191a1b;
        font-size: 16px;
        height: 22px;
        line-height: 22px;
        margin-right: 5px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .item {
        font-size: 9px;
        color: #fff;
        background-color: #d2d6dc;
        height: 14px;
        line-height: 14px;
        padding: 0 2px;
        border-radius: 2px;
      }
    }

    .film-grade {
      .label {
        font-size: 13px;
        margin-top: 4px;
        color: #797d82;
      }
      .grade {
        color: #ffb232;
        font-size: 14px;
      }
    }

    .film-actors {
      .label {
        font-size: 13px;
        margin-top: 4px;
        color: #797d82;
      }
    }

    .film-detail {
      .label {
        font-size: 13px;
        margin-top: 4px;
        color: #797d82;
      }
    }
  }
  .buy {
    flex-shrink: 0;
    line-height: 25px;
    height: 25px;
    width: 50px;
    color: #ff5f16;
    font-size: 13px;
    text-align: center;
    border-radius: 2px;
    position: relative;
  }
}
</style>
